/**
 * 字典表单配置
 * @typedef {Object} FormConfig
 */
export const formConfig = [
  {
    field: 'title',
    label: '公告标题',
    component: 'Input',
    placeholder: '请输入公告标题',
    rules: [
      { required: true, message: '请输入公告标题', trigger: 'blur' },
      { min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur' },
    ],
  },
  {
    field: 'status',
    label: '状态',
    component: 'Radio',
    options: [
      { label: '启用', value: '1' },
      { label: '禁用', value: '0' },
    ],
    rules: [{ required: true, message: '请选择状态', trigger: 'change' }],
  },
  {
    field: 'content',
    label: '公告内容',
    component: 'Input',
    placeholder: '请输入公告内容',
    props: {
      type: 'textarea',
      rows: 10,
    },
    rules: [{ required: true, message: '请输入公告内容', trigger: 'blur' }],
  },
]

/**
 * 获取表单默认值
 */
export const getDefaultFormData = () => {
  return {
    id: '',
    title: '',
    content: '',
    status: '1',
  }
}
